package com.linyf.design.factoryMethod.simple;

import com.linyf.design.factoryMethod.impl.Product;

/**
 * @Author: linyf
 * @Description: TODO
 * @DateTime: 2023/3/27 14:10
 **/
public class ProductSimpleFactory {

    public static <T extends Product> T createProduct(Class<T> c) {

        Product human = null;
        try {

            human = (Product) Class.forName(c.getName()).newInstance();

        } catch (Exception e) {
            e.printStackTrace();
        }

        return (T) human;
    }
}
